Magnesium-based alloys are potential lightweight materials for automotive applications and the use of the alloys may significantly improve the vehicle fuel economy. However, the poor corrosion resistance of Mg alloys significantly limits their wider application. The corrosion performance of Mg AZ31 alloy is among the poorest compared with other common cast Mg alloys, such as AZ91 or AM60. There is a need for a method of improving the corrosion resistance of workpieces of susceptible magnesium based alloys.